package com.yan.lesson01;

import java.net.InetAddress;
import java.net.UnknownHostException;

//测试ip
public class TestInetAddress {
    public static void main(String[] args) throws UnknownHostException {
        InetAddress inetAddress = InetAddress.getByName("127.0.0.1");
        System.out.println(inetAddress);
        inetAddress = InetAddress.getLocalHost();
        System.out.println(inetAddress);
        inetAddress = InetAddress.getByName("www.baidu.com");
        System.out.println(inetAddress);
    }
}
